<template>
  <div
    class="card"
    v-if="(ossUrl||imgUrl)&&data"
    :style="{backgroundImage:'url('+(data.goods_image?imgUrl+data.goods_image:ossUrl+'/mp_3.2.4/bg_queen_card.png')+')'}"
  >
    <div class="name">{{data.name||''}}</div>
    <div class="desc">{{data.desc||''}}</div>
    <div class="bottom">
      <div class="price">
        <span class="yang">¥</span>
        <span>{{data.price}}</span>
      </div>
      <div
        class="supply"
        v-if="data.min_sale_price&&data.goods_deduction_type!=0"
      >最低可至¥{{data.min_sale_price}}</div>
      <div class="sale" v-if="data.sale&&order_scene!=2">已售：{{data.sale}}</div>
    </div>
  </div>
</template>

<script>
import common from "@/assets/js/mmk_common.js";
export default {
  props: {
    data: {
      //券数据
      type: Object,
      default: ""
    }
  },
  data() {
    return {
      ossUrl: common.image_resource, //oss图片
      imgUrl: common.image_response //http图片
    };
  }
};
</script>

<style lang="less" scoped>
.card {
  min-height: 155px;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border-radius: 8px;
  padding: 20px;
  box-sizing: border-box;
  position: relative;
  .name {
    font-size: 18px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: rgba(255, 255, 255, 1);
    line-height: 25px;
    margin-bottom: 5px;
  }
  .desc {
    width: 78%;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
    line-height: 20px;
    margin-bottom: 27px;
    text-overflow: -o-ellipsis-lastline;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .bottom {
    width: 88%;
    overflow: hidden;
    position: absolute;
    left: 20px;
    bottom: 20px;
    .price {
      float: left;
      font-size: 21px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(255, 255, 255, 1);
      line-height: 18px;
      .yang {
        font-size: 14px;
      }
    }
    .supply {
      float: left;
      font-size: 12px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(255, 255, 255, 0.8);
      line-height: 16px;
      margin: 2px 0 0 8px;
    }
    .sale {
      float: right;
      font-size: 12px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(255, 255, 255, 1);
      line-height: 17px;
    }
  }
}
</style>